package www.lagou.app;

import org.junit.Test;
import www.lagou.dao.AccountDao;
import www.lagou.entity.Account;

import java.sql.SQLException;

public class testAccountDao {
    AccountDao accountDao=new AccountDao();
    @Test
    public void testAccountDao() throws SQLException {

        //1.创建Account对象
        Account account1=new Account(1,"tom","1122334455",accountDao.money("1122334455"));
        Account account2=new Account(2,"lucy","55443332211",accountDao.money("55443332211"));
        boolean result=accountDao.transfer(account1,account2,5000.00);
        if (result){
            Double balance1 = accountDao.money("1122334455");
            Double balance2=accountDao.money("55443332211");
            System.out.println("转账成功,tom当前余额为："+balance1+",lucy当前余额为" +
                    balance2);
        }else {
            System.out.println("转账失败");
        }




    }
}
